home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
db2eagle.zip
/
DB2EAGLE.DOC
< prev
next >
Wrap
Text File
|
1993-01-04
|
10KB
|
202 lines
db2eagle.exe is a translator for Clipper/dBASE III syntax to
Eagle syntax. I wrote to facilitate my own conversions.
My special thanks goes to John Willis of Willpro Software who
showed me the basics of program translations.
db2eagle.exe is written in Quick Basic. It clears the screen,
and asks for the name of the .prg file without the extension
(must be .prg). For example: main.prg is entered as main and
creates main.pgm). It doesn't change the original .prg file but
will overwrite the .pgm file if it already exists without warning.
This is what you would want in most every case anyway. It
translates most important commands but NOT every command. It
does the major work for the main syntax changes that you might
overlook. It REQUIRES full SYNTAX (i.e. SET PROCEDURE will work
and not SET PROC). This is because 1.) I didn't have time to make
it work and 2.) I never use syntax like CLEA MEMO, since it's hard
to read and a compiler like CLIPPER removes extra syntax anyway.
Please note this is a line by line translator and makes no attempt
to figure out your program logic. For example:
dBASE III code: will translate as:
SELECT B *!! SELECT B - needs alias
USE billing INDEX billdate USE billing INDEX billdate
... .
USE payment INDEX paydate USE payment INDEX paydate
... .
USE CLOSE TABLE payment
Thus in dBASE III, USE payment will close billing, but in Eagle
you would have to manually add CLOSE TABLE billing since
translator would miss this syntax. Thus you should manually check
all code, for these hidden syntax changes. However, you won't
miss an ENDDO that should be an ENDWHILE, like I used to do.
The program is free and can be uploaded to other BBS systems.
As a free product, there is no warranty of any kind. As
P.L.Olympia always says "it works for me." It has been tested on
IBM and AST computers with EGA & VGA. Since it doesn't use color,
it should also work on monochrome monitors. If you are concerned
about viruses, the original was uploaded on FORUMBOARD's Migent SIG.
The only BBS I check regularly is FORUMBOARD. If you don't yet
belong to it, you should if you are an Eagle programmer. Jordan
Brown who is the author of Eagle regularly answers correspondence
in the Migent SIG. Try to get this type of support from other
database vendors.
You can write to me at:
James J. Orlowski
451 West Gonzales Road, #150
Oxnard, CA 93030
Source code is not available, I don't have time to process it.
If a professional software vendor wants to market a cleaned up,
fancier version, make me an offer. For most programmers, this
version should be good enough.
The following syntax is correctly translated by this translator.
Functions:
BOF() -> BOT()
EOF() -> EOT()
IIF() -> IF()
LASTKEY() = 27 -> READKEY() = 271 && Escape key
LASTKEY() -> READKEY()
REPLICATE() -> char * num
SPACE() -> ' ' * num
STUFF() -> REPLACE()
* picture translations
NOTE: @ functions are not translated !
99/99/99 -> 0m/0d/yy
L and Y -> PICTURE "u" OPTION 't"Yes"f"No"'
9999.99 -> 4.2 && corrects all decimals properly plus adds
OPTIONS "f*" for "*", "f$" for "$", ",+" for ","
999 -> 3 && all integers are converted to numbers plus adds
OPTIONS "f*" for "*", "f$" for "$", ",+" for ","
if need string input, you must manually change to 3d
! -> u
A -> (ul)
N -> (uld)
X -> x
Syntax
Removes Additive from: RESTORE FROM ... ADDITIVE
Commands
DO WHILE -> WHILE
ENDDO -> ENDWHILE
DO CASE -> SWITCH
ENDCASE -> ENDSWITCH
NEXT -> ENDFOR
CLEAR ALL -> RESET
CLEAR MEMORY -> RESET MEMORY
CLOSE DATABASES -> always adds "SET DATABASE TO database" after this statment
SET PROCEDURE TO procname -> LOAD procname
* also stores procname for UNLOAD procname
CLOSE PROCEDURE -> if haven't previously used SET PROCEDURE TO ... may get:
*!!! Eagle Requires Alias to UNLOAD <procedure_name>
* UNLOAD ???
GOTO -> GO
MENU TO memvar -> READ && always converts
memvar = READGET() && to these two lines
PACK -> eliminated since unnecessary in Eagle.
RESTORE SCREEN -> RESTORE SCREEN FROM tmp_scrn_buf
* Note: RESTORE SCREEN FROM is same Clipper & Eagle
SAVE SCREEN -> SAVE SCREEN TO tmp_scrn_buf
SAVE SCREEN TO image -> SAVE SCREEN image
SELECT A TO J-> gives *!! SELECT - Needs Alias message
SELECT tablename -> * stores tablename for possible CLOSE TABLE tablename
SET BELL -> SET BEEP
SET CONSOLE -> SET DISPLAY
SET DELETED -> eliminated since unnecessary in Eagle.
SET ESCAPE -> SET BREAK
SET DEVICE TO PRINT -> SET OUTPUT TO PRINT
SET DEVICE TO SCREEN -> SET OUTPUT TO SCREEN
SET MARGIN TO -> SET PRINTER LEFT MARGIN TO
SET MARGIN TO linenum CENTER -> SET MARGIN TO linenum && CENTER
&& Eagle currently doesn't support CENTER
SET PRINT ON/OFF -> SET PRINTER ON/OFF
SET RELATION TO fieldname INTO alias -> LINK TO alias by fieldname
** Problem is SET RELATION TO: needs to be changed to LINK TO alias
** to unlink relation so translator notes with *!! message here
SET SAFETY -> eliminated
SET SCOREBOARD -> eliminated
SET COLOR TO dbase_color -> SET COLOR 3 TO eagle_color && dbase_color
&& eagle colors always written as 1 + 7*16 for B/W
&& or 1 + 128 + 7*16 for B*/W for easier deciphering.
USE tablename-> * stores tablename for possible CLOSE TABLE tablename
USE tablename ALIAS aliasname -> * stores aliasname
* for possible CLOSE TABLE tablename
USE -> may get if haven't previously used USE or SELECT
*!!! Eagle Requires Alias to CLOSE TABLE <alias_name>
* CLOSE TABLE ???
ZAP -> eliminated
Conversion Problems - Need Manual Correction
1.) FIND: only works with one field and not multiple fields, so
you should probably convert to SEEK.
2.) PROMPTs need to convert numeric format of CLIPPER to READGET() format
3.) @ BOX frametop needs to be converted manually. You might try to
use my FRAME.BIN uploaded on FORUMBOARD MIGENT SIG if you just
want to match up corners of single and double lines.
4.) IF .NOT. EOF() converted to IF .NOT. EOT(),
but should check to see if should be changed to
a.) IF .NOT. FOUND() or b.) IF .NOT. EXACT()
5.) String comparisons within Eagle are exact operators with the
exception that = is inexact and == is exact.
THUS: SET FILTER TO mcode <> "Z" in CLIPPER which would not allow
code = Z1 must be changed in Eagle TO:
SET FILTER TO .NOT. mcode = "Z"
6.) PICTUREs must be converted dealing with @ functions
7.) Most TRIMs since trim has different meaning in Eagle since it
uses variable length fields.
8.) Most SAYs of character data will probably need to use PADR()
since Eagle uses variable length fields.
9.) SET COLOR TO U && Clipper for Underline on monochrome monitors
was not translated since I don't know what it would be in Eagle.
No Eagle Equivalent - May Need To Write UDFs or Rewrite Code
1.) AFILL(), ADEL(), AINS() - Array handling is very different
since Eagle requires arrays to be same type (i.e. character,
numeric, date, etc.) while Clipper is not typed and can mix
different types within an array. However, Eagle can have
up to 13 dimensions versus 1 for Clipper. If your array is
the same type, these can be easily written in UDFs.
2.) DBEDIT() - no equivalent. I hope this is eventually added.
3.) MEMOEDIT() - no equivalent. Jordan Brown has uploaded
SHOW.bin to show a binary field, which is probably the
read only equivalent of MEMOEDIT(). This can be partially worked
around by using extensions in binary.bin.
4.) DELETED() - no equivalent but really this is an advantage
since NEVER HAVE TO PACK.
5.) DTOS() - no equivalent but again this is an advantage since
indexes can use syntax SEEK idnumber, date() and don't have
to figure out how to convert criteria to string so don't have
to use convoluted SEEK idnumber + DTOS(date()) as in Clipper.
6.) FOPEN()/FCLOSE()/FSEEK()/FERROR() - no equivalent for binary files
but OPEN, CLOSE, etc. in textio.bin can work with text files.
7.) SET ORDER TO - no equivalent. Since index handling automatic
you don't have to remember the order but just use SET INDEX TO.
8.) TEXT...ENDTEXT - no equivalent. Ask Jordan.
9.) LOCK commands are supposed to be in the next update so
exact syntax is unknown at this time. In most cases, you would
want to use TRANSACTION BEGIN/COMMIT/ABORT anyway, so you would
be better off to rewrite it.
Not implemented within db2eagle.exe
1.) SAVESCREEN() & RESTSCREEN() from Clipper not converted
2.) SEEK: need to change + to ,
3.) INDEX ON: need to change + to ,
5.) SETCOLOR() need to change to:
oldcolor = COLOR(eagle_color_number)
SET COLOR eagle_color_number TO
6.) SET FUNCTION <expN> to proc must be converted to
SET FUNCTION "f2" TO DO proc
7.) SET KEY TO: not yet implemented within Eagle, if later added
as part of a future update, it will probably need manual correction
since Jordan used different key codes than dBASE III/Clipper.
8.) All other SET commands.